package com.eorchis.module.statistics.trainingcompletionrate.ui.commond;

import java.math.BigDecimal;

public class TrainingCompletionRateValidCommond {

	private String ministrieId;//部委ID
	private String ministrieName;//部委名称
	private String signUnitId;// 单位ID
	private String signUnitCode;// 单位编码
	private String signUnitName;// 单位名称
	private Integer planUserCount;// 计划总人数
	private Integer actualUserCount;// 实际班级报名总人数
	private Double complationRate;// 单位调训完成率
	private String complationRateStr;// 单位调训完成率

	public String getSignUnitId() {
		return signUnitId;
	}

	public void setSignUnitId(String signUnitId) {
		this.signUnitId = signUnitId;
	}

	public String getSignUnitName() {
		return signUnitName;
	}

	public void setSignUnitName(String signUnitName) {
		this.signUnitName = signUnitName;
	}

	public Integer getPlanUserCount() {
		return planUserCount;
	}

	public void setPlanUserCount(Integer planUserCount) {
		this.planUserCount = planUserCount;
	}

	public Integer getActualUserCount() {
		return actualUserCount;
	}

	public void setActualUserCount(Integer actualUserCount) {
		this.actualUserCount = actualUserCount;
	}

	public Double getComplationRate() {
		if(complationRate==null||complationRate==0){
			int actual = this.actualUserCount==null?0:this.actualUserCount;
			int plan = this.planUserCount==null?0:this.planUserCount;
			if(actual==0||plan==0){
				complationRate = 0D;
			}else{
//				complationRate = ((double)actual/plan) > 1 ? 1 : ((double)actual/plan);
				complationRate = ((double)actual/plan);
			}
		}
		return complationRate;
	}

	public void setComplationRate(Double complationRate) {
		this.complationRate = complationRate;
	}

	public String getComplationRateStr() {
		if(complationRateStr==null||"".equals(complationRateStr)){
			BigDecimal bd = new BigDecimal(getComplationRate()*100);
			double d = bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
			complationRateStr = d+"%";
		}
		return complationRateStr;
	}

	public void setComplationRateStr(String complationRateStr) {
		this.complationRateStr = complationRateStr;
	}

	public String getSignUnitCode() {
		return signUnitCode;
	}

	public void setSignUnitCode(String signUnitCode) {
		this.signUnitCode = signUnitCode;
	}

	public String getMinistrieId() {
		return ministrieId;
	}

	public void setMinistrieId(String ministrieId) {
		this.ministrieId = ministrieId;
	}

	public String getMinistrieName() {
		return ministrieName;
	}

	public void setMinistrieName(String ministrieName) {
		this.ministrieName = ministrieName;
	}

}
